package com.eclink.asset.util;

import java.io.File;
import java.io.FileOutputStream;
import java.util.Base64;

public class Base64Util {

    /**
     * Base64 转 File
     *
     * @param base64
     * @param filePath
     * @return
     */
    public static File base64ToFile(String base64, String filePath) {
        File file = new File(filePath);
        byte[] buffer;
        try {
            buffer = Base64.getDecoder().decode(base64);
            FileOutputStream out = new FileOutputStream(filePath);
            out.write(buffer);
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return file;
    }

}
